var bRecommendWinAdd;
var bRecommendFormAdd;
function addBRecommend(){
	initBRecommendFormAdd();
	bRecommendWinAdd = Ext.create('Ext.Window',{
		layout:'border',
		width:800,
		height:400,
		maximized:true,
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'添加信息',
		headerPosition:'left',
		listeners:{
			minimize:function(win,opts){
				win.collapse();
			}
		},
		items:bRecommendFormAdd,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(bRecommendFormAdd,'../bRecommendController/addBRecommend',grid,bRecommendWinAdd,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	bRecommendWinAdd.show();
}
function initBRecommendFormAdd(){
	bRecommendFormAdd = Ext.create('Ext.FormPanel',{
		region:'center',
		waitMsgTarget:true,
		defaultType:'textfield',
		autoScroll:true,
		fieldDefaults:{
			labelWidth:70,
			labelAlign:'left',
			flex:1,
			margin:'2 5 4 5'
		},
		items:[{
					fieldLabel:'推荐标题',
					xtype:'textfield',
					name:'b_recommend_title',
					maxLength:100,
					width:400
				},
				{
					fieldLabel:'链接地址',
					xtype:'textfield',
					name:'b_recommend_url',
					maxLength:500,
					width:400
				},
				{
					fieldLabel:'排&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;序',
					xtype:'numberfield',
					value:'0',
					name:'b_recommend_sort',
					width:200
				},
				{
					fieldLabel:'宽&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;度',
					xtype:'numberfield',
					value:'1920',
					name:'b_recommend_width',
					width:200
				},
				{
					fieldLabel:'高&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;度',
					xtype:'numberfield',
					value:'470',
					name:'b_recommend_height',
					width:200
				},
				{
					fieldLabel:'备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注',
					xtype:'textareafield',
					name:'b_recommend_remark',
					maxLength:200,
					anchor:'60%'
				},
				{
					fieldLabel:'状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态',
					name:'b_recommend_status',
					xtype:"combo",
		            store:[["0","可用"],["1","禁用"]],
		            emptyText:"请选择",
		            mode:"local",
		            value:'0',
		            triggerAction:"all",
		            editable:false,
					hiddenName:'b_recommend_status',
					allowBlank:false,
					maxLength:2,
					width:200
				},
				{
					fieldLabel:'附件编号',
					xtype:'textfield',
					name:'xt_attachment_id',
					id:'xt_attachment_id',
					maxLength:32,
					hidden:true,
					width:200
				},
				{
					title:'上传图片',
				    xtype:'box',//或者xtype:'component',  
					fieldLabel:"图&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;片",
					id:'pic',
					anchor:'60%',
					padding:'2 5 4 80',
					autoEl:{  
				        tag:'img',			    
				        onclick:'clickHandler()',    
				        src:basePath+"/deng/images/default/default.jpg"
				    } 
				}
		]
	});
	/**初次赋值改变容器中路径用该方法**/
	//Ext.getCmp('pic').autoEl.src = "http://127.0.0.1:8080/hsimg/images/b_recommend_path/20160111173746143234.png";
}